<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.tb_logs.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	
	Map tb_logs = new Hashtable();
	
	String ipaddr = "";
	if(request.getParameter("ipaddr")!=null && !request.getParameter("ipaddr").equals("")){
		ipaddr = request.getParameter("ipaddr");
		tb_logs.put("ip",ipaddr);
	}
	
	String session_user_name = "";	
	if( session.getAttribute("session_user_name") != null ){
		session_user_name = session.getAttribute("session_user_name").toString();
		tb_logs.put("user_name",session_user_name);
	}
	
	String txtStartDate = "";
	if(request.getParameter("txtStartDate")!=null && !request.getParameter("txtStartDate").equals("")){
		txtStartDate = request.getParameter("txtStartDate");
		tb_logs.put("start_date",txtStartDate);
	}
	String txtEndDate = "";
	if(request.getParameter("txtEndDate")!=null && !request.getParameter("txtEndDate").equals("")){
		txtEndDate = request.getParameter("txtEndDate");
		tb_logs.put("end_date",txtEndDate);
	}
	
	Tb_logsInfo tb_logsInfo = new Tb_logsInfo();
	String iStart = "0";
	int limit = 20; 
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = tb_logsInfo.getListByPage(tb_logs,Integer.parseInt(iStart),limit);
	int counter = tb_logsInfo.getCountByObj(tb_logs);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?ipaddr="+ipaddr
	+"&txtStartDate="+txtStartDate+"&txtEndDate="+txtEndDate+"&iStart=",Integer.parseInt(iStart),limit);
	
	String para ="ipaddr="+ipaddr
	+"&txtStartDate="+txtStartDate+"&txtEndDate="+txtEndDate+"&iStart="+Integer.parseInt(iStart);
%>
<html>
  <head>
    <title>我的操作日志</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="logs.js" charset="UTF-8"></script>
	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>我的操作日志</h1>
			</td>
			<td>
				<!--a href="addInfo.jsp"><img src="/program/admin/index/images/post.png" /></a-->
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<!--table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>您可以按“行业”或“关键字”订阅</h4>
		  <span>1、填写关键字，您将及时了解与该产品相关的所有商机。</span><br/>
		  <span>2、为了更准确订阅，建议你选择产品所属的行业大类和行业子类。</span>
		  </td>
        </tr>
      </table-->
      
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left">
				IP:<input name="ipaddr" type="text" size="15" />
				时间段:<input name="txtStartDate" type="text" id="txtStartDate" class="Wdate" value="" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'txtEndDate\',{d:-1})}',readOnly:true})" size="15" /> - <input name="txtEndDate" id="txtEndDate" type="text" class="Wdate" value="" onclick="WdatePicker({minDate:'#F{$dp.$D(\'txtStartDate\',{d:1})}',readOnly:true})" size="15"/>
				<input name="searchInfo" type="submit" value="查询"/>	
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td align="center"><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			
		  	<th>业务名称</th>
		  	
		  	<th>操作结果</th>
		  	
		  	<th>IP</th>
		  	
		  	<th>操作时间</th>
		  	
				<th width="10%">查看</th>
	  		
		</tr>
		
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String trade_id="",trade_type_code="",oper_result="",result="",
		  				ip="",oper_date="",user_name="",user_id="",trade_name="";
  			  		if(map.get("trade_id")!=null) trade_id = map.get("trade_id").toString();
				  	if(map.get("trade_type_code")!=null) {
				  		trade_type_code = map.get("trade_type_code").toString();
				  		trade_name = tb_logsInfo.getTradeNameById(trade_type_code);
				  	}
				  	if(map.get("oper_result")!=null) {
				  		oper_result = map.get("oper_result").toString();
				  		if(oper_result.equals("0")){
				  			result = "成功";
				  		}
				  		if(oper_result.equals("1")){
				  			result = "失败";
				  		}
				  	}
				  	if(map.get("ip")!=null) ip = map.get("ip").toString();
				  	if(map.get("oper_date")!=null) oper_date = map.get("oper_date").toString();
						if(oper_date.length()>19)oper_date=oper_date.substring(0,19);
				  	if(map.get("user_name")!=null) user_name = map.get("user_name").toString();
				  	

		  %>
		
		<tr>
			
		  	<td><%=trade_name%></td>
		  	
		  	<td><%=result%></td>
		  	
		  	<td><%=ip%></td>
		  	
		  	<td><%=oper_date%></td>
		  	
				<td width="10%"><a href="viewInfo.jsp?trade_id=<%=trade_id%>&<%=para%>"><img src="/program/admin/images/view.gif" title="查看" /></a></td>
	  		
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td align="center"><%=pageString%></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="1250" />
	  </form>
</body>

</html>
